
-- import("../test/commonlib/test_xml.lua")
-- local __paint__ = commonlib.GetPaint();
-- _G.__on_paint__ = function()
--     __paint__.SetBrushColor(0xff0000ff);
--     __paint__.DrawRectangle(0, 0, 200, 200, true, false);
--     __paint__.SetFontColor(0x000000ff);
--     __paint__.SetFontSize(26);
--     __paint__.DrawText(100, 300, 500, 500, "hello 测试",0,1,false)
-- end

if (not commonlib.IsServer()) then
	import("../test/window/test_window.lua");
end

-- local val = {
--     key = 1,
--     obj = {
--         val = 2,
--     }
-- }
-- -- print(commonlib.tostring(val))

-- commonlib.warn(1,2, val, "hello world")

-- commonlib.ShowWindow({
--     width = 256,
--     height = 256,
--     OnPaint = function(window)
--         window:SetBrushColor(0xffff00ff);
--         window:DrawRectangle(0, 0, 200, 200);
--         window:SetPenColor(0x000000ff);
--         window:MoveTo(0, 0)
--         window:DrawCurve(0, 0, 200, 200, 200, 200, false, true);
--         -- window:LineTo(0, 0);
--         -- window:SetBrushColor(0xff0000ff);
--         -- window:Fill();
--     end
-- });


-- import("./matatalab/init.lua");

--commonlib.echo("=================app script init=================")
-- local uv = _G.luv

-- -- Create a handle to a uv_timer_t
-- local timer = uv.new_timer()

-- -- This will wait 1000ms and then continue inside the callback
-- timer:start(1000, 0, function ()
--   -- timer here is the value we passed in before from new_timer.

--   print ("Awake!")

--   -- You must always close your uv handles or you'll leak memory
--   -- We can't depend on the GC since it doesn't know enough about libuv.
--   timer:close()
-- end)

-- print("Sleeping");

-- -- uv.run will block and wait for all events to run.
-- -- When there are no longer any active handles, it will return
-- uv.run()
-- print("luv==", _G.luv == nil)
-- print(commonlib.JsonEncode({key = "value"}, true))

--commonlib.HttpGet("http://www.baidu.com")

-- print(os.date("%a %d %b %Y %H:%M:%S +1100"))
-- commonlib.exit();

-- commonlib.SetInterval(0, function()
--   commonlib.__xpcall__(function()
--     commonlib.__luv__.run("nowait");
--   end)
-- end)
-- commonlib.SetTimeout(5000, function()
--   commonlib.exit();
-- end)

-- local serpent = require("serpent")
-- local a = {1, nil, 3, x=1, ['true'] = 2, [not true]=3, obj = {key = 1}}
-- a[a] = a -- self-reference with a table as key and value

-- print(serpent.dump(a)) -- full serialization
-- print(serpent.line(a)) -- single line, no self-ref section
-- print(serpent.block(a, {indent = "    "})) -- multi-line indented, no self-ref section
-- commonlib.SetTimeout(2000, function()
--   commonlib.exit();
-- end)
